package com.yangjun.controller;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yangjun.dao.mybatis.mapper.report.ProductInfoReportExportMapper;
import com.yangjun.dao.mybatis.mapper.yinong.YiNongMapper;
import com.yangjun.dao.mybatis3.mapper.reportImport.BIDEVReportImportMapper;
import com.yangjun.entity.yinong.YiNongOrderEntity;
import com.yangjun.entity.yinong.YiNongOrderLogEntity;
import com.yangjun.service.MailService;
import com.yangjun.utils.DvDateUtils;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;

@RestController
@RequestMapping("/mail")
public class MailController {
	@Autowired
	private MailService mailService;
	@Autowired
	protected BIDEVReportImportMapper reportImportMapper;
	@Autowired
	private ProductInfoReportExportMapper productInfoReportExportMapper;
	@Autowired
	private YiNongMapper yiNongMapper;
	
	
	@RequestMapping("/yinong/saveOrder")
	@ResponseBody
	public Object saveOrder() throws ParseException{
		String date = "2019-06-27";


		return null;
	}
	
	@RequestMapping("/test")
	@ResponseBody
	public Object test() throws ParseException{
//		Long start = System.currentTimeMillis();
//		List<String> dwKadBaseWareDList = productInfoReportExportMapper.queryFinancialCategory();
//		System.out.println(dwKadBaseWareDList.size());
//		Long end = System.currentTimeMillis();
//		System.out.println((end-start)/1000);
//		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//		for(int i=1;i<=1;i++){
//			String yesterday = DvDateUtils.getDate(new Date(),-i);
			String yesterday = "2019-07-15";
			//邝玲玲
//			mailService.sendAppSalesReport(yesterday);
//			mailService.sendWebSalesReport(yesterday);
//			mailService.sendSEMSourceKeywordReport("day",yesterday,yesterday,true);
//			mailService.sendSEOSourceKeywordReport("day",yesterday,yesterday,true);
//			mailService.sendSeoProductFlowReport(yesterday);
//			mailService.sendSeoProductSalesReport(yesterday);
//			mailService.sendSeoChannelFlowSalesReport(yesterday);
//		}
//		mailService.sendSEMSourceKeywordReport(yesterday,true);
		return null;
	}
		
}
